package com.manger.utils;

import com.manger.format.*;

public enum DetNameEnum {

    OPPO(1,"oppo", OppoCaseFilesFormat.class),

    VIVO(2,"vivo", VivoCaseFilesFormat.class),

    SPLIT_PAY(3,"分期乐", SplitPayCaseFilesFormat.class),

    GOOD_PAY(4,"好分期", GoodPayCaseFilesFormat.class),

    JDD(5,"桔多多",OrangeMoreMoreCaseFilesFormat.class),

    RXD(6,"任性贷",RXDPayCaseFilesFormat.class),

    NUM_360(7,"360",ThreeSixZeroCaseFilesFormat.class),

    XF(8,"信飞",XFPayCaseFilesFormat.class),

    XW(9,"新网",XWPayCaseFilesFormat.class),

    XM(10,"小米",SmallMiCaseFilesFormat.class),

    JR(11,"极融", JiRongCaseFilesFormat.class),

    MB(12,"满帮", ManBangCaseFilesFormat.class),

    ZX(13,"中信", ZXCaseFilesFormat.class),

    XEHQ(14,"小鹅还钱", XEHQFilesFormat.class),

    SU_NING(15,"苏宁",SuNingCaseFilesFormat.class);

    private int code;

    private String desc;

    private Class<? extends CaseFilesFormat> clazz;


    private DetNameEnum(int code, String desc, Class<? extends CaseFilesFormat> clazz) {
        this.code = code;
        this.desc = desc;
        this.clazz = clazz;
    }

    public static DetNameEnum getDetNameEnumByEndWith(String path) {
        DetNameEnum[] values = DetNameEnum.values();
        for (DetNameEnum value : values) {
            if(path.toLowerCase().endsWith(value.desc.toLowerCase())) {
                return value;
            }
        }
        return null;
    }

    public static DetNameEnum geDetNameEnumByDesc(String desc) {
        DetNameEnum[] detNameEnums = DetNameEnum.values();
        for (DetNameEnum value : detNameEnums) {
            if(value.desc.equals(desc)) {
                return value;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public Class<? extends CaseFilesFormat> getClazz() {
        return clazz;
    }
}
